<template>
  <div>
    <div v-if="courses.length === 0">没有任何课程信息</div>
    <div v-else>
      <transition-group name="fade">
        <p
          @click="selectedCourse=item"
          :class="{activeCourse:selectedCourse === item}"
          v-for="item in courses"
          :key="item.name"
        >{{ item.name }} 价格是：{{item.price}}</p>
      </transition-group>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      selectedCourse: ""
    };
  },
  props: {
    courses: {
      type: Array,
      default: function() {}
    }
  },
  filters: {
    Currency: function(value) {
      return "￥" + value;
    }
  }
};
</script>

<style lang="scss" scoped>
.active {
  background-color: #ddd;
}
</style>